package ycj.learn.spring.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class JDKDynamicProxyTest
{

    public static void main(String[] args) {
        IHelloWorld proxyInstance = (IHelloWorld)Proxy.newProxyInstance(
                IHelloWorld.class.getClassLoader()
                , new Class<?>[]{IHelloWorld.class}
                , (proxy, method, ags) -> {

                    System.out.println("Executed method: " + method.getName());
                    for (Object arg : ags) {
                        System.out.println("Parameter:" + arg);
                    }
                    return null;
        });


        proxyInstance.sayHello("wsdf");

    }
}
